﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

/// <summary>
/// 函数来表达计算器
/// </summary>
/*
 *name:姚铁
 *time：2017.9.8
 */

namespace work_8_1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("请输入要使用的计算方法" + "+ - * /");
            string a = Console.ReadLine();
            switch (a)
            {
                case "+":
                    JiaFa();
                    break;
                case "-":
                    JianFa();
                    break;
                case "*":
                    ChengFa();
                    break;
                case "/":
                    ChuFa();
                    break;
                default:
                    Console.WriteLine("输入错误");
                    break;
            }
        }
        //加法函数
        static void JiaFa()
        {
            Console.WriteLine("请输入数值进行加法计算");
            int a1 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("+");
            int a2 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("=" + (a1 + a2));
            Console.ReadKey();
        }
        //减法函数
        static void JianFa()
        {
            Console.WriteLine("请输入数值进行减法计算");
            int b1 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("-");
            int b2 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("=" + (b1 + b2));
            Console.ReadKey();
        }
        //乘法函数
        static void ChengFa()
        {
            Console.WriteLine("请输入数值进行乘法计算");
            int c1 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("*");
            int c2 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("=" + (c1 * c2));
            Console.ReadKey();
        }
        //除法函数
        static void ChuFa()
        {
            Console.WriteLine("请输入数值进行除法计算");
            int d1 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("/");
            int d2 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("=" + (d1 / d2));
            Console.ReadKey();
        }
    }
}
